#include "events.h"

#include "ui_mainwindow.h"

void Events::createActions()
{
	connect(m_accelerometer,
		SIGNAL(readingsChanged(double, double, double, double)),
		this,
		SLOT(updateValues(double, double, double, double))
	);
}

void Events::updateValues(double x, double y, double z, double amp)
{
	m_main->ui->horizontalSlider->setValue(x);
	m_main->ui->horizontalSlider_2->setValue(y);
	m_main->ui->horizontalSlider_3->setValue(z);

	m_main->ui->amplitudeValue->setText(QString::number(amp));

	if (amp > 4) {
		m_sounds->playRandomSwing();
	}
}
